from turbogears.database import PackageHub
from sqlobject import *

hub = PackageHub('wwwpayaso')
__connection__ = hub

# class YourDataClass(SQLObject):
#     pass
 

class Photo(SQLObject):
    names = UnicodeCol(default="")
    #hour = TimeCol(notNone=True)
    disco = ForeignKey("Disco")
    date = ForeignKey("Date")
    image = UnicodeCol(notNone=True, unique=True)
    thumbail = UnicodeCol(notNone=True, unique=True)


class Disco(SQLObject):
    name = UnicodeCol(notNone=True, unique=True)
    address = UnicodeCol(default="")
    telephone = UnicodeCol(default="")
    http = UnicodeCol(default="")
    description = UnicodeCol(default="")
    logo = UnicodeCol(default="")

    def __str__(self):
            return self.name

class Date(SQLObject):
    date = DateCol(notNone=True, unique=True)
    #hour = TimeCol(notNone=True)

    def __str__(self):
            return self.date.isoformat()


class News(SQLObject):
    date = ForeignKey("Date")
    disco = ForeignKey("Disco")
    short_description = UnicodeCol(notNone=True)
    long_description = UnicodeCol(notNone=True)
    title = UnicodeCol(notNone=True)